<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/public/inc/tags.jsp"%>
<html>
<head>
    <jsp:include page="/public/inc/head.jsp"/>
</head>
<body>
<div id="header" class="navbar navbar-static-top" role="navigation">
    <jsp:include page="/public/inc/top.jsp"/>
</div>
<div class="container-fluid" style="margin-top:5px;margin-bottom:60px;">
    <div class="row">
        <jsp:include page="/public/inc/menu.jsp"/>
        <div class="col-xs-12 col-sm-10">
            <div class="panel panel-primary">
                <div class="panel-heading">
                    <div class="media">
                        <div class="media-body">
                            <span class="glyphicon glyphicon-list"></span> 编辑
                        </div>
                        <div class="media-right">
                            <a href="/system/upms_user/list" class="btn btn-primary">
                                <span class="glyphicon glyphicon-plus"></span> 返回
                            </a>
                        </div>
                    </div>
                </div>
                <div class="panel-body">
                    <form id="form1" action="/system/upms_user/update" method="post" enctype="multipart/form-data">
                        <input type="hidden" value="${model.userId}" name="userId">
                        <div class="form-horizontal">
                            <div class="form-group">
                                <label class="control-label col-md-2">用户昵称</label>
                                <div class="col-md-4">
                                    <input type="text" id="realname" name="realname" class="form-control"
                                           value="${model.realname}" placeholder="请输入用户昵称"/>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-md-2">类别</label>
                                <div class="col-md-4">
                                    <select name="sex" id="type" class="form-control">
                                        <option value="0">请选择</option>
                                        <option value="1" <c:if test="${model.sex==1}"> selected="selected"</c:if>>男</option>
                                        <option value="2" <c:if test="${model.sex==2}"> selected="selected"</c:if>>女</option>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-md-2">手机号</label>
                                <div class="col-md-4">
                                    <input type="text" id="phone" name="phone" value="${model.phone}" class="form-control" placeholder="请输入手机号">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-md-2">邮箱</label>
                                <div class="col-md-4">
                                    <input type="text" id="email" name="email" value="${model.email}" class="form-control" placeholder="请输入邮箱">
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-md-offset-2 col-md-10">
                                <button type="submit" class="btn btn-primary">
                                    <i class="fa fa-floppy-o"></i> 保存
                                </button>
                            </div>
                        </div>
                        <script type="text/javascript">
                            $(document).ready(function () {
                                $("#form1").bootstrapValidator({
                                    feedbackIcons: {
                                        valid: 'glyphicon glyphicon-ok',
                                        invalid: 'glyphicon glyphicon-remove',
                                        validating: 'glyphicon glyphicon-refresh'
                                    },
                                    fields: {
                                        realname: {
                                            validators: {
                                                notEmpty: {
                                                    message: '不能为空'
                                                }
                                            }
                                        },
                                        phone: {
                                            validators: {
                                                notEmpty: {
                                                    message: '不能为空'
                                                },
                                                regexp: {
                                                    regexp: /^(((13[0-9]{1})|(15[0-9]{1})|(17[0-9]{1})|(18[0-9]{1}))+\d{8})$/,
                                                    message: '手机号格式不正确'
                                                }
                                            }
                                        },
                                        email: {
                                            validators: {
                                                emailAddress: {
                                                    message: '邮箱格式不正确'
                                                }
                                            }
                                        }
                                    }
                                });
                            });
                        </script>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<jsp:include page="/public/inc/bottom.jsp"/>
</body>
</html>